home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Workbench / ToolManager / Source / global.h < prev   
C/C++ Source or Header  |  1998-06-17  |  7KB  |  210 lines

  1. /*
  2.  * global.h  V3.1
  3.  *
  4.  * Global definitions
  5.  *
  6.  * Copyright (C) 1990-98 Stefan Becker
  7.  *
  8.  * This source code is for educational purposes only. You may study it
  9.  * and copy ideas or algorithms from it for your own projects. It is
  10.  * not allowed to use any of the source codes (in full or in parts)
  11.  * in other programs. Especially it is not allowed to create variants
  12.  * of ToolManager or ToolManager-like programs from this source code.
  13.  *
  14.  */
  15.  
  16. /* Version */
  17. #define TMVERSION "3.1"
  18.  
  19. /* Copyright year */
  20. #define TMCOPYRIGHTYEAR "1990-98"
  21.  
  22. /* Handler task name */
  23. #define TMHANDLERNAME "ToolManager Handler"
  24.  
  25. /* Catalog name */
  26. #define TMCATALOGNAME "toolmanager.catalog"
  27.  
  28. /* Catalog version */
  29. #define TMCATALOGVERSION 5
  30.  
  31. /* Configuration file name */
  32. #define TMCONFIGNAME "ToolManager.prefs"
  33.  
  34. /* ToolManager configuration file version */
  35. #define TMCONFIGVERSION "$VER: ToolManagerPrefs 3.0"
  36.  
  37. /* IFF FORM types for ToolManager configuration */
  38. /* LIST & FORM types */
  39. #define ID_TMPR MAKE_ID('T','M','P','R') /* TM configuration file type    */
  40. #define ID_TMGP MAKE_ID('T','M','G','P') /* ToolManager global settings   */
  41. #define ID_TMEX MAKE_ID('T','M','E','X') /* ToolManager Exec object       */
  42. #define ID_TMIM MAKE_ID('T','M','I','M') /* ToolManager Image object      */
  43. #define ID_TMSO MAKE_ID('T','M','S','O') /* ToolManager Sound object      */
  44. #define ID_TMMO MAKE_ID('T','M','M','O') /* ToolManager Menu object       */
  45. #define ID_TMIC MAKE_ID('T','M','I','C') /* ToolManager Icon object       */
  46. #define ID_TMDO MAKE_ID('T','M','D','O') /* ToolManager Dock object       */
  47. #define ID_TMAC MAKE_ID('T','M','A','C') /* ToolManager Access object     */
  48.  
  49. /* Property types */
  50. #define ID_CDIR MAKE_ID('C','D','I','R') /* Current directory             */
  51. #define ID_CMND MAKE_ID('C','M','N','D') /* Command name                  */
  52. #define ID_DATA MAKE_ID('D','A','T','A') /* Fixed data structure          */
  53. #define ID_ENTR MAKE_ID('E','N','T','R') /* ToolManager dock entry        */
  54. #define ID_FILE MAKE_ID('F','I','L','E') /* File name                     */
  55. #define ID_FONT MAKE_ID('F','O','N','T') /* Font name                     */
  56. #define ID_FVER MAKE_ID('F','V','E','R') /* OS V37+ version string        */
  57. #define ID_HKEY MAKE_ID('H','K','E','Y') /* Hotkey description            */
  58. #define ID_OGRP MAKE_ID('O','G','R','P') /* Object group name             */
  59. #define ID_OUTP MAKE_ID('O','U','T','P') /* Output file name              */
  60. #define ID_NAME MAKE_ID('N','A','M','E') /* Object name                   */
  61. #define ID_PATH MAKE_ID('P','A','T','H') /* Command path                  */
  62. #define ID_PORT MAKE_ID('P','O','R','T') /* ARexx port name               */
  63. #define ID_PSCR MAKE_ID('P','S','C','R') /* Public screen name            */
  64.  
  65. /* Definitions for global settings */
  66. #define DATA_GLOBALF_NETWORKENABLE    0x1
  67. #define DATA_GLOBALF_REMAPENABLE      0x2
  68. #define DATA_GLOBALF_MASK             0x3 /* All valid flags */
  69. #define DATA_GLOBAL_PRECISION_DEFAULT 1   /* Default remap precisions */
  70. #define DATA_GLOBAL_PRECISION_MAX     4   /* Supported remap precisions */
  71. struct GlobalDATAChunk {
  72.  ULONG gdc_Flags;
  73.  ULONG gdc_Precision;
  74. };
  75.  
  76. /* Data structures for DATA chunks */
  77. struct StandardDATAChunk {
  78.  ULONG sdc_ID;             /* Object ID    */
  79.  ULONG sdc_Flags;          /* Object Flags */
  80. };
  81.  
  82. /* Definitions for Exec objects */
  83. #define DATA_EXECF_ARGUMENTS 0x1
  84. #define DATA_EXECF_TOFRONT   0x2
  85. #define DATA_EXECF_MASK      0x3 /* All valid flags */
  86. struct ExecDATAChunk {
  87.  struct StandardDATAChunk edc_Standard;
  88.  UWORD                    edc_ExecType;
  89.  WORD                     edc_Priority;
  90.  ULONG                    edc_Stack;
  91. };
  92.  
  93. /* Definitions for Image objects */
  94. #define DATA_IMAGEF_MASK 0x0 /* All valid flags */
  95. /* Uses StandardDataChunk */
  96.  
  97. /* Definitions for Sound objects */
  98. #define DATA_SOUNDF_MASK 0x0 /* All valid flags */
  99. /* Uses StandardDataChunk */
  100.  
  101. /* Definitions for Menu objects */
  102. #define DATA_MENUF_MASK 0x0 /* All valid flags */
  103. struct MenuDATAChunk {
  104.  struct StandardDATAChunk mdc_Standard;
  105.  ULONG                    mdc_ExecObject;
  106.  ULONG                    mdc_SoundObject;
  107. };
  108.  
  109. /* Definitions for Icon objects */
  110. #define DATA_ICONF_SHOWNAME 0x1
  111. #define DATA_ICONF_MASK     0x1 /* All valid flags */
  112. struct IconDATAChunk {
  113.  struct StandardDATAChunk idc_Standard;
  114.  ULONG                    idc_LeftEdge;
  115.  ULONG                    idc_TopEdge;
  116.  ULONG                    idc_ExecObject;
  117.  ULONG                    idc_ImageObject;
  118.  ULONG                    idc_SoundObject;
  119. };
  120.  
  121. /* Definitions for Dock objects */
  122. #define DATA_DOCKF_ACTIVATED 0x001
  123. #define DATA_DOCKF_MENU      0x002
  124. #define DATA_DOCKF_BORDER    0x004
  125. #define DATA_DOCKF_IMAGES    0x008
  126. #define DATA_DOCKF_TEXT      0x010
  127. #define DATA_DOCKF_CENTERED  0x020
  128. #define DATA_DOCKF_STICKY    0x040
  129. #define DATA_DOCKF_BACKDROP  0x080
  130. #define DATA_DOCKF_FRONTMOST 0x100
  131. #define DATA_DOCKF_POPUP     0x200
  132. #define DATA_DOCKF_MASK      0x3FF /* All valid flags */
  133. struct DockDATAChunk {
  134.  struct StandardDATAChunk ddc_Standard;
  135.  ULONG                    ddc_LeftEdge;
  136.  ULONG                    ddc_TopEdge;
  137.  ULONG                    ddc_Columns;
  138.  UWORD                    ddc_FontYSize;
  139.  UBYTE                    ddc_FontStyle;
  140.  UBYTE                    ddc_FontFlags;
  141. };
  142. struct DockEntryChunk {
  143.  ULONG dec_ExecObject;
  144.  ULONG dec_ImageObject;
  145.  ULONG dec_SoundObject;
  146. };
  147.  
  148. /* Definitions for Access objects */
  149.  
  150. /* Debugging */
  151. #ifdef DEBUG
  152. /* Global data */
  153. extern ULONG DebugFlags[DEBUGFLAGENTRIES];
  154.  
  155. /* Function prototypes */
  156. void            InitDebug(const char *);
  157. #ifdef DEBUGPRINTTAGLIST
  158. const char     *GetTagName(ULONG);
  159. void            PrintTagList(const struct TagItem *);
  160. #endif
  161. void            kprintf(const char *, ...);
  162. __stkargs void  KPutChar(char);
  163. __stkargs void  KPutStr(const char *);
  164.  
  165. /* Macros */
  166. #define INITDEBUG(name)          InitDebug(#name);
  167. #define _DEBUGHEADER(func, text) __FILE__ "/" #func "/" #text ": "
  168. #define DEBUGHEADER(text)        _DEBUGHEADER(DEBUGFUNCTION, text)
  169. #define ERROR_LOG(x)             x;
  170. #define _LOG(o, b, x)            if (DebugFlags[o] & (1 << (b))) x;
  171. #define LOG0(x)                  KPutStr(DEBUGHEADER(x) "-\n")
  172. #define LOG1(x, f, a)            kprintf(DEBUGHEADER(x) f "\n",(a))
  173. #define LOG2(x, f, a, b)         kprintf(DEBUGHEADER(x) f "\n",(a),(b))
  174. #define LOG3(x, f, a, b, c)      kprintf(DEBUGHEADER(x) f "\n",(a),(b),(c))
  175. #define LOG4(x, f, a, b, c, d)   kprintf(DEBUGHEADER(x) f "\n",(a),(b),(c),(d))
  176. #define LOG5(x, f, a, b, c, d, e) \
  177.                              kprintf(DEBUGHEADER(x) f "\n",(a),(b),(c),(d),(e))
  178. #else
  179. #define INITDEBUG(name)
  180. #define DEBUGHEADER(x)
  181. #define ERROR_LOG(x)
  182. #define LOG0(x)
  183. #define LOG1(x)
  184. #define LOG2(x)
  185. #define LOG3(x)
  186. #define LOG4(x)
  187. #define LOG5(x)
  188. #endif
  189.  
  190. /* Log information only if DEBUG is greater than zero */
  191. #if DEBUG > 0
  192. #define INFORMATION_LOG(x) x;
  193. #else
  194. #define INFORMATION_LOG(x)
  195. #endif
  196.  
  197. /* Memory */
  198. BOOL  InitMemory(void);
  199. void  DeleteMemory(void);
  200. void *GetMemory(ULONG);
  201. void  FreeMemory(void *, ULONG);
  202. void *GetVector(ULONG);
  203. void  FreeVector(void *);
  204.  
  205. /* Miscellaneous */
  206. #define GetHead(list) GetSucc((struct MinNode *) (list))
  207. #define GetTail(list) GetPred((struct MinNode *) &(list)->mlh_Tail)
  208. struct MinNode *GetSucc(struct MinNode *);
  209. struct MinNode *GetPred(struct MinNode *);
  210.